<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>饱了么点餐平台</title>

<link rel="stylesheet" type="text/css" href="../files/styles.css">
<script type="text/javascript" src="../files/js/jquery.min.js"></script>
<script type="text/javascript" src="../files/js/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(function(){
	var mname = false;
	$("#memName").blur(function(){
		var name = $("#memName").val()
	
		url = "../member/findByName.action";
		datas = {
			memName : name
		};
		$.ajax({
			asyn : true,
			tyspe : "POST",
			url : url,
			data : datas,
			success : function(fh) {
				if(fh.msg == "0"){
					$("#userTishi").text("账号可以使用");
					mname = true ;
				}else{
					$("#userTishi").text("该账号已被注册!");
					mname = false ;
				}
			}
		});
	});
	
	$("#userSubmit").click(function(){
		
		if(mname==true){
			url = "../member/saveOrUpdate.action";
			datas = {
				memName : $("#memName").val(),
				memPwd : $("#memPwd").val(),
				introduce : $("#introduce").val()
			};
			$.ajax({
				asyn : true,
				type : "POST",
				url : url,
				data : datas,
				success : function(fh) {
					if(fh.msg == "0"){
						setTimeout(function(){
							location.href = "../page/log.html";
						},200);
					}
				}
			});
		}
	});
});
</script>
<style type="text/css">
	#userTishi{
		color:red;
	}
</style>
</head>
<body>
		<div style="height: 30px;"></div>
		<div class="login-wrap" id="regist">
			<div class="login-html">
				<input id="tab-1" type="radio" name="tab" class="sign-in" checked /><label
					for="tab-1" class="tab">注册</label> <input id="tab-2" type="radio"
					name="tab" class="sign-up" />
				<div class="login-form">
					<div class="group">
						<label for="user" class="label">用户名</label> 
						<input id="memName" name="memName" type="text" class="input" maxlength="15" required="required"  />
					</div>
					<p id="userTishi"></p>
					<div class="group">
						<label for="pass" class="label">密码</label> <input id="memPwd"
							name="memPwd" type="password" class="input" data-type="password" maxlength="20"
							required="required" />
					</div>
					<div class="group">
						<label for="pass" class="label">备注</label> <input id="introduce"
							name="introduce" type="text" class="input" data-type="text" maxlength="15"
							required="required" />
					</div>
					<div class="group">
						<input type="submit" class="button" value="注册" id="userSubmit" name="userSubmit" />
					</div>
					<div class="hr"></div>
					<div class="foot-lnk">
						<a href="../page/log.html">已注册登录?</a>
					</div>
				</div>
			</div>
		</div>
</body>
</html>